package com.gw.vip.server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gw.vip.server.po.HisOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

/**
 * @author GW
 * @description
 * @since 2022-05-05
 */
public interface HisOrderMapper extends BaseMapper<HisOrder> {
    /**
     * 根据清算日期查询交易数量
     * @param clearDate
     * @return
     */
    @Select("SELECT COUNT(1) FROM his_order WHERE clear_date=#{clearDate}")
    int countByClearDate(LocalDate clearDate);

    /**
     * tmpTrans表转hisTrans
     * @param clearDate
     */
    @Insert("INSERT INTO his_order (SELECT * FROM tmp_order WHERE clear_date=#{clearDate})")
    void tmpTransToHis(LocalDate clearDate);
}
